package com.example.service.impl;

import com.example.entity.InfoAttachment;
import com.example.mapp.InfoAttachmentMapp;
import com.example.service.InfoAttachmentService;
import com.example.util.ResultUtil;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import ch.qos.logback.classic.Logger;

/**
 * Created by simon on 2018/3/21.
 */
@Service
public class InfoAttachmentServiceImpl implements InfoAttachmentService{

    private final static Logger logger = (Logger) LoggerFactory.getLogger(InformationServiceImpl.class);

    @Autowired
    InfoAttachmentMapp infoAttachmentMapp;

    /**
     * 更具机构类型和资讯类型查 初始化的资讯信息
     * @param obj
     * @return
     */
    @Override
    public Map<String, Object> queryByType(Map<String, Object> obj){

        List<InfoAttachment> list =null;
        Map<String,Object> map = new HashMap();
        try {
            list = infoAttachmentMapp.queryByType(obj);

            map.put("list",list);
        } catch (Exception e) {
            e.printStackTrace();
            logger.error(e.getMessage());
            return ResultUtil.returnError("查询失败"+e.getMessage(),null);
        }

        return ResultUtil.returnSuccess("查询成功",map);

    }

}
